/**
  isShow
    1. 如果当前路由未传isShow，则获取到的是undefined--->false  ---> 在侧边栏不展示
    2. 
*/

// 对外暴露配置路由（常量路由）
export const constantRoute = [
  // 登录
  {
    // 登录
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      title: '登录',
      // 当前路由是否在侧边栏展示
      isShow: true,
      icon: 'View',
    },
  },
  // layout
  {
    // 登录成功后展示数据的路由
    path: '/',
    name: 'Layout',
    redirect: '/home',
    component: () => import('@/layout/index.vue'),
    meta: {
      // 路由的标题（给项目侧边栏用）
      title: '',
      icon: '', // 菜单文字左侧的图标，支持element-plus全部图标
    },
    children: [
      {
        path: 'home',
        name: 'Home',
        component: () => import('@/views/home/index.vue'),
        meta: {
          title: '首页',
          icon: 'HomeFilled',
        },
      },
    ],
  },
  // 数据大屏
  {
    path: '/screen',
    name: 'Screen',
    component: () => import('@/views/screen/index.vue'),
    meta: {
      title: '数据大屏',
      icon: 'Monitor',
    },
  },
  // 权限管理
  {
    path: '/acl',
    name: 'Acl',
    component: () => import('@/layout/index.vue'),
    redirect: '/acl/user',
    meta: {
      title: '权限管理',
      icon: 'Lock',
    },
    children: [
      {
        path: 'user',
        name: 'User',
        component: () => import('@/layout/Acl/User/index.vue'),
        meta: {
          title: '用户管理',
          icon: 'Sunrise',
        },
      },
      {
        path: 'role',
        name: 'Role',
        component: () => import('@/layout/Acl/Role/index.vue'),
        meta: {
          title: '角色管理',
          icon: 'MostlyCloudy',
        },
      },
      {
        path: 'menu',
        name: 'Menu',
        component: () => import('@/layout/Acl/Menu/index.vue'),
        meta: {
          title: '菜单管理',
          icon: 'Lightning',
        },
      },
    ],
  },
  // 商品管理
  {
    path: '/goods',
    name: 'Goods',
    component: () => import('@/layout/index.vue'),
    redirect: '/goods/brand',
    meta: {
      title: '商品管理',
      icon: 'Suitcase',
    },
    children: [
      {
        path: 'brand',
        name: 'Brand',
        component: () => import('@/layout/Goods/Brand/index.vue'),
        meta: {
          title: '品牌管理',
          icon: 'ElementPlus',
        },
      },
      {
        path: 'attribute',
        name: 'Attribute',
        component: () => import('@/layout/Goods/Attribute/index.vue'),
        meta: {
          title: '属性管理',
          icon: 'SwitchFilled',
        },
      },
      {
        path: 'spu',
        name: 'Spu',
        component: () => import('@/layout/Goods/SPU/index.vue'),
        meta: {
          title: 'SPU管理',
          icon: 'Eleme',
        },
      },
      {
        path: 'sku',
        name: 'Sku',
        component: () => import('@/layout/Goods/SKU/index.vue'),
        meta: {
          title: 'SKU管理',
          icon: 'ChromeFilled',
        },
      },
    ],
  },
  // 富文本
  {
    path: '/wangEditer',
    name: 'WangEditer',
    redirect: '/home',
    component: () => import('@/layout/index.vue'),
    meta: {
      title: '',
      icon: '',
    },
    children: [
      {
        path: '/wangEditer',
        name: 'Edit',
        component: () => import('@/layout/wangEditer/index.vue'),
        meta: {
          title: '富文本',
          icon: 'Sunrise',
        },
      },
    ],
  },
  // 404
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/404/index.vue'),
    meta: {
      title: '404',
      // 当前路由是否在侧边栏展示
      isShow: true,
    },
  },
  // 任意路由，当输入的路由地址为定义过则会重定向到404
  {
    path: '/:pathMatch(.*)*',
    redirect: '/404',
    name: 'Any',
    meta: {
      title: 'Any',
      // 当前路由是否在侧边栏展示
      isShow: true,
    },
  },
]
